Access the index of a listΒΆ
Write a python program access the index of a list.
L = [5, 15, 35, 8, 98]
for num_index, num_val in enumerate(L):
print(num_index, num_val)
Output:
0 5
1 15
2 35
3 8
4 98
L = [5, 15, 35, 8, 98]
for num_index, num_val in enumerate(L):
print(num_index, num_val)
Output:
0 5
1 15
2 35
3 8
4 98